# coding:utf-8


class FirstMetaClass(type):
    # cls代表动态修改的类
    # name代表动态修改的类名
    # bases代表被动态修改的类的所有父类
    # attr代表被动态修改的类的所有属性、方法组成的字典
    def __new__(cls, name, bases, attrs):
        # 动态为该类添加一个name属性
        attrs['name'] = "C语言中文网"
        attrs['say'] = lambda self: "调用 say() 实例方法"
        return type.__new__(cls,name,bases,attrs)


class MLan(object, metaclass=FirstMetaClass):
    def __init__(self):
        self.abc = "abc"


m_lan = MLan()
print (m_lan.abc)
